<%@ page import="br.com.jambu.cge.Agente" %>



<div class="fieldcontain ${hasErrors(bean: agenteInstance, field: 'nome', 'error')} required">
	<label for="nome">
		<g:message code="agente.nome.label" default="Nome" />
		<span class="required-indicator">*</span>
	</label>
	<g:textField name="nome" required="" value="${agenteInstance?.nome}"/>
</div>

<div class="fieldcontain ${hasErrors(bean: agenteInstance, field: 'cliente', 'error')} required">
	<label for="cliente">
		<g:message code="agente.cliente.label" default="Cliente" />
		<span class="required-indicator">*</span>
	</label>
	<g:select id="cliente" name="cliente.id" from="${br.com.jambu.cge.Cliente.list()}" optionKey="id" required="" value="${agenteInstance?.cliente?.id}" class="many-to-one"/>
</div>

<div class="fieldcontain ${hasErrors(bean: agenteInstance, field: 'endereco', 'error')} ">
	<label for="endereco">
		<g:message code="agente.endereco.label" default="Endereco" />
		
	</label>
	
<ul class="one-to-many">
<g:each in="${agenteInstance?.endereco?}" var="e">
    <li><g:link controller="endereco" action="show" id="${e.id}">${e?.encodeAsHTML()}</g:link></li>
</g:each>
<li class="add">
<g:link controller="endereco" action="create" params="['agente.id': agenteInstance?.id]">${message(code: 'default.add.label', args: [message(code: 'endereco.label', default: 'Endereco')])}</g:link>
</li>
</ul>

</div>

